package com.dk.service.template;

import com.alibaba.dubbo.config.annotation.Service;
import com.dk.mapper.template.TbTypeTemplateMapper;
import com.dk.pojo.template.TbTypeTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Service
@Component
public class TemplateServiceImpl implements TemplateService{

    @Resource
    private TbTypeTemplateMapper tbTypeTemplateMapper;

    @Override
    public List<TbTypeTemplate> listTemplate() {
        return tbTypeTemplateMapper.selectByExample(null);
    }

    @Override
    public TbTypeTemplate getTemplateById(Long templateId) {
        return tbTypeTemplateMapper.selectByPrimaryKey(templateId);
    }

    @Override
    public int deleteTemplateByIds(Long[] ids) {
        return tbTypeTemplateMapper.deleteTemplateByIds(ids);
    }

    @Override
    public int updateTemplate(TbTypeTemplate template) {
        return tbTypeTemplateMapper.updateByPrimaryKeySelective(template);
    }

    @Override
    public TbTypeTemplate templateById(Long id) {
        return tbTypeTemplateMapper.selectByPrimaryKey(id);
    }

    @Override
    public int insertTemplate(TbTypeTemplate template) {
        return tbTypeTemplateMapper.insertSelective(template);
    }
}
